import * as apiService from '@/services/api'

/**
 * 取得公司明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportCompanyListApi = (params) => {
  return apiService.post(api.REPORT_COMPANY_LIST,
    params);
};

/**
 * 取得公司明细子列表
 * @param params
 * @returns {Promise<*>}
 */
const reportCompanySubListApi = (params) => {
  return apiService.post(api.REPORT_COMPANY_SUB_LIST,
    params);
};

/**
 * 取得代理明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportAgencyListApi = (params) => {
  return apiService.post(api.REPORT_AGENCY_LIST,
    params);
};

/**
 * 取得代理明细子列表
 * @param params
 * @returns {Promise<*>}
 */
const reportAgencySubListApi = (params) => {
  return apiService.post(api.REPORT_AGENCY_SUB_LIST,
    params);
};

/**
 * 取得游戏明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportGameListApi = (params) => {
  return apiService.post(api.REPORT_GAME_LIST,
    params);
};

/**
 * 取得玩家明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportPlayerListApi = (params) => {
  return apiService.post(api.REPORT_PLAYER_LIST,
    params);
};

/**
 * 取得玩家明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportPlayerSubListApi = (params) => {
  return apiService.post(api.REPORT_PLAYER_SUB_LIST,
    params);
};

/**
 * 取得交易明细列表
 * @param params
 * @returns {Promise<*>}
 */
const reportTransactionListApi = (params) => {
  return apiService.post(api.REPORT_TRANSACTION_LIST,
    params);
};
/**
 * 取得上分记录列表
 * @param params
 * @returns {Promise<*>}
 */
const reportAgencyCreditListApi = (params) => {
  console.log(params)
  const {startTime, endTime, size, page, username, minAmount, maxAmount, keywords} = params

  if (_.isUndefined(keywords) && _.isEmpty(keywords)) {
    return apiService.post(api.AGENCY_CREDIT_REPORT,
      {startTime, endTime, size, page, username, minAmount, maxAmount});
  }

  return apiService.post(api.AGENCY_CREDIT_REPORT,
    params);
};

/**
 * 上分报表
 * @param params
 * @returns {Promise<*>}
 */
const upAmountList = (params) => {
  return apiService.post(api.AGENCY_CREDIT_UPAMOUNT,
    params);
};
/**
 * 上分报表详情
 * @param params
 * @returns {Promise<*>}
 */
const upAmountDetail = (params) => {
  return apiService.post(api.AGENCY_CREDIT_UPAMOUNT_DETAIL,
    params);
};
/**
 * 导出会员输赢记录列表
 * @param params
 * @returns {Promise<*>}
 */
const exportMemberWin = (params) => {
  return apiService.post(api.EXPORT_MEMBER_WIN_LIST,
    params);
};

/**
 * 导出代理输赢报表
 * @param params
 * @returns {Promise<*>}
 */
const exportAgencyList = (params) => {
  return apiService.post(api.AGENCY_LIST_LIST,
    params);
};
export {
  reportCompanyListApi,
  reportCompanySubListApi,
  reportAgencyListApi,
  reportAgencySubListApi,
  reportGameListApi,
  reportPlayerListApi,
  reportPlayerSubListApi,
  reportTransactionListApi,
  reportAgencyCreditListApi,
  exportMemberWin,
  upAmountList,
  upAmountDetail,
  exportAgencyList
};
